package com.gujia.concurrent.countdownlatch;

import sun.jvm.hotspot.debugger.ThreadAccess;

import java.util.concurrent.CountDownLatch;

public class ModuleThread implements Runnable{


    private CountDownLatch latch;
    private String name;
    private String time;

    public ModuleThread(CountDownLatch latch, String name, String time) {
        this.latch = latch;
        this.name = name;
        this.time = time;
    }

    @Override
    public void run() {
        this.work();
        this.latch.countDown();

    }


    public void work(){
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName()
        +"->完成模块："+name+"，花了"+time+"工作日");
    }
}
